﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using StuMngVan.Dals;
using StuMngVan.Entities;

namespace StuMngVan
{
    public partial class FormAddStudent : Form
    {
        public FormAddStudent()
        {
            InitializeComponent();
        }

        private void FormAddStudent_Load(object sender, EventArgs e)
        {

        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            ///【闻祖东 2013-3-28-192328】这种方式并不面向对象。小月处理的是四个冷冰冰的临时变量而已。
            //string sName = txtName.Text;
            //string sAddress = txtAddress.Text;
            //int iAge = Convert.ToInt16(txtAge.Text);
            //string sRemark = txtRemark.Text;

            Student stu = new Student();

            stu.Name = txtName.Text;
            stu.Address = txtAddress.Text;
            stu.Age = Convert.ToInt32(txtAge.Text);
            stu.Remark = txtRemark.Text;

            Dal4Student.InsertStudent(stu);
            MessageBox.Show(string.Format("恭喜你添加【{0}】学员基本信息成功！", stu.Name));
            this.Close();
        }
    }
}
